package XPathProj;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;

import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;

import junit.framework.Assert;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.xml.sax.SAXException;




@RunWith(Parameterized.class)
public class TestList {
 
    @Parameters
    public static Collection<Object[]> data() {
 
        return Arrays.asList(new Object[][] { { "/inventory/book[3]/preceding-sibling::book[1]", "/inventory/book{3}[3]/preceding-sibling::book{1}[1]"}, 
        									  { "/inventory/book[chapter[section]]", "/inventory/book{1}[chapter{1}[section{1}]]"},  
        									  { "/inventory/book[3] | /inventory/book[2]", "/inventory/book{3}[3]"},
        									  {"/inventory/book[chapter[section[paragraph[image]]]]/chapter/section/paragraph[image]", "/inventory/book{1}[chapter{1}[section{1}[paragraph{2}[image{1}]]]]/chapter{1}/section{1}/paragraph{2}[image{1}]"},
        									  { "/inventory/book[not((price>14 and price<2) or price=7.50)]", "/inventory/book{1}[not((price{1}>14 and price<2) or price{1}=7.50)]"},
        									  {"/inventory/book[(price>14 and price<2) or price=7.50]" , "/inventory/book{1}[(price{2}>14 and price{3}<2) or price=7.50]"},
        									  {"/inventory/book[not(price>10 or price<1)][chapter[title]][2]" , "/inventory/book{2}[not(price>10 or price<1)][chapter{1}[title]][2]"}, // TODO UNTIL 17.5 WAS "/inventory/book{2}[not(price>10 or price<1)][chapter{1}[title]]{2}[2]"
        									  {"/inventory/book[price > 5]" , "/inventory/book{1}[price{2}>5]"},
        									  {"/inventory/book[2]" , "/inventory/book{2}[2]"},
        									  {"/inventory/book[@num]" , "/inventory/book{1}[@num]"},
        									  {"inventory/book[not(not(chapter[section]))] | /inventory/book[last()]" , "/inventory/book{1}[not(not(chapter[section]))]"},
        									  {"/inventory/book[chapter][not(last())][2]" , "/inventory/book{2}[chapter{1}][not(last())][2]"}, // TODO UNTIL 17.5 WAS "/inventory/book{2}[chapter{1}][not(last())]{2}[2]"
        									  {"/inventory/book/price[.>5]" , "/inventory/book{1}/price{2}[self::price>5]"},
        									  {"id(//@num)[..//price[. = .] > ./price]" , "/id(/descendant-or-self::node()/@num{\"b1 b2 b3\"}){1}[parent::inventory/descendant-or-self::book{3}/price{1}[self::price=self::price]>self::book/price{3}]"},
        									  {"/inventory/book/chapter[paragraph][last()]" , "/inventory/book{1}/chapter{3}[paragraph][last()]"},
        									  {"/inventory/book/.[price]" , "/inventory/book{1}/self::book[price{1}]"},
        									  {"/inventory/book[5<price]" , "/inventory/book{1}[5<price{2}]"},
        									  {"/inventory/book/price[self::node()/self::node()/text()>0]" , "/inventory/book{1}/price{1}[self::price/self::price/text()>0]"},
        									  {"/inventory/book/price/self::node()[5<text()]" , "/inventory/book{1}/price{2}/self::price[5<text()]"},
        									  {"//inventory/./book/price/self::node()[5<text()]" , "/descendant-or-self::#document{1}/inventory/self::inventory/book{1}/price{2}/self::price[5<text()]"},
        									  {"/inventory/book[3]/preceding-sibling::book" , "/inventory/book{3}[3]/preceding-sibling::book{1}"},
        									  {"(/inventory/book/chapter)[last()]" , "(/inventory/book{3}/chapter){6}[last()]"},
        									  {"/inventory/book[not(not(not(priceor | chapter/sectio)))]" , "/inventory/book{1}[not(not(not(priceor | chapter/sectio)))]"}, // TODO
        									  {"/inventory/book[orbach or (chapter/section | price[self::node()>5]) or (ofri or chapter) or (price>5)]" , "/inventory/book{1}[orbach or (chapter{1}/section{1}) or (ofri or chapter{1}) or (price{2}>5)]"},
        									  {"/inventory/book[(price=4.99) or (price>5)]" , "/inventory/book{1}[(price=4.99) or (price{2}>5)]"},
        									  {"/inventory/book/chapter[last()]" , "/inventory/book{1}/chapter{3}[last()]"},
        									  {"/inventory/book[count(chapter)]" , "/inventory/book{2}[count(chapter)]"},
        									  {"/inventory/book[position() > 1][position()=1 or count(chapter)=1]" , "/inventory/book{2}[position()>1][position()=1 or count(chapter)=1]"},
        									  {"/inventory/book[(price>14 and price<2) or price=7.50]" , "/inventory/book{1}[(price{2}>14 and price{3}<2) or price=7.50]"},
        									  {"/inventory/book//(chapter)[last()]" , "/inventory/book{1}/descendant-or-self::book{1}(/chapter{3}){3}[last()]"},
        									  {"/inventory/book[chapter/title][position() > 1]" , "/inventory/book{2}[chapter{1}/title][position()>1]"},
        									  {"//author[last()]" , "/descendant-or-self::book{4}/author[last()]"},							  
        									  {"/inventory/book[count(author)>=2][true()][1]" , "/inventory/book{2}[count(author)>=2][true()][1]"},
        									  {"/inventory/family/person[@gender=\"male\"][last()]" , "/inventory/family/person{8}[@gender=\"male\"][last()]"},
        									  {"id(\"b1 b2\")[//chapter][last()]" , "/id(\"b1 b2\"{\"b1 b2\"}){2}[descendant-or-self::book{4}/chapter{1}][last()]"},
        									  {"/inventory[5<book/price]" , "/inventory[5<book{1}/price{2}]"},
        									  {"(/inventory[(not((book/price) < (book/price)))])" , "(/inventory[not((book{1}/price{1})<(book{1}/price{1}))])"},
        									  {"/inventory/book/price[0 < self::node()/self::node()/text()]" , "/inventory/book{1}/price{1}[0<self::price/self::price/text()]"},
        									  {"/inventory/book[not(self::node()[price<0] | chapter/section)]" , "/inventory/book{3}[not(self::node()[price<0] | chapter/section)]"},
        									  {"/inventory/book[not(1 > 1)]" , "/inventory/book{1}[not(1>1)]"},
        									  {"/inventory/book[not(chapter/section and price<0)]" , "/inventory/book{1}[not(chapter/section or price{1}<0)]"},
        									  {"/inventory/book[id(@num)/price>5]", "/inventory/book{1}[id(@num{\"b1\"})/price{1}>5]"},
        									  {"/inventory/book[id(@num)/price> id(@num)/price/text()]", "/inventory/book{1}[id(@num{\"b1\"})/price{1}>id(@num{\"b1\"})/price{3}/text()]"},
        									  {"/inventory/book[5 < id(@num)/price]", "/inventory/book{1}[5<id(@num{\"b1\"})/price{1}]"},
        									  {"/inventory/book[chapter][not(id(@num)/price > 15)]", "/inventory/book{1}[chapter{1}][not(id(@num{\"b1\"})/price{1}>15)]"},
        									  {"/inventory/book[chapter][not(15 < id(@num)/price)]", "/inventory/book{1}[chapter{1}][not(15<id(@num{\"b1\"})/price{1})]"},
        									  {"/inventory/book[chapter][not(id(@num)/price < id(@num)/price)]", "/inventory/book{1}[chapter{1}][not(id(@num{\"b1\"})/price{1}<id(@num{\"b1\"})/price{1})]"},
        									  {"/inventory/book[(chapter)]", "/inventory/book{1}[chapter{1}]"},
        									  {"/inventory/book[not((chapt))]", "/inventory/book{1}[not((chapt))]"},
        									  {"/inventory/book[(chapter)][not(false())]", "/inventory/book{1}[chapter{1}][not(false())]"},
        									  {"/inventory/book[(chapter)][1][true()]", "/inventory/book{1}[chapter{1}][1][true()]"},
        									  {"/inventory/book[(chapter)][true()][position() = 2]", "/inventory/book{2}[chapter{1}][true()][position()=2]"},
        									  {"/inventory/(book[chapter])[2]", "/inventory(/book{2}[chapter{1}]){2}[2]"},
        									  {"/inventory/book[not(5 < self::node()/price)][last()]", "/inventory/book{1}[not(5<self::book/price{1})][last()]"},
        									  {"/inventory/book[not(chapter/price)]", "/inventory/book{1}[not(chapter/price)]"},
        									  {"/inventory/book[chapter][not(self::node()/price < id(@num)/price)]", "/inventory/book{1}[chapter{1}][not(self::book/price{1}<id(@num{\"b1\"})/price{1})]"},
        									  {"/inventory/book[chapter][not(id(@num)/price > self::node()/price)]", "/inventory/book{1}[chapter{1}][not(id(@num{\"b1\"})/price{1}>self::book/price{1})]"},
        									  {"/inventory/book[not(15 < self::node()/price)][(not(false()))]", "/inventory/book{1}[not(15<self::book/price{1})][not(false())]"},
        									  {"/inventory/book[last()]", "/inventory/book{3}[last()]"},
        									  {"/inventory/book[not(chapter/price)][not(last())]", "/inventory/book{1}[not(chapter/price)][not(last())]"},
        									  {"/inventory/book[chapter][not(id(@num)/price > self::node()/price)][(((last())))]", "/inventory/book{3}[chapter][not(id(@num{\"b3\"})/price{1}>self::book/price{1})][last()]"},
        									  {"//book[id(@num)]", "/descendant-or-self::inventory{2}/book{1}[id(@num{\"b1\"})]"},
        									  {"/inventory/book[chapter and (self::node/price | chapter/section)]", "/inventory/book{1}[chapter{1} and (chapter{1}/section{1})]"},
        									  {"/inventory/book[not(chapte)]", "/inventory/book{1}[not(chapte)]"},
        									  {"/inventory/book[not(chapter/price > 5)]", "/inventory/book{1}[not(chapter/price > 5)]"},
        									  {"(//chapter)[2]/title/text()", "(/descendant-or-self::book{4}/chapter{2}){2}[2]/title/text()"},
        									  {"/inventory/book[/inventory/book[id(@num)/price>5]/self::node()/author]", "/inventory/book{1}[inventory/book{1}[id(@num{\"b1\"})/price{1}>5]/self::book/author]"},
        									  {"/inventory/book[not(/inventory/book[id(@num)/price>5]/self::node()/auth)]", "/inventory/book{1}[not(/inventory/book[id(@num)/price>5]/self::node()/auth)]"},
        									  {"/inventory/book[not(not(true()))]/chapter", "/inventory/book{1}[not(not(true()))]/chapter{1}"},
        									  {"/inventory/book[1+2-position()+position()+0]/preceding::book[last()]", "/inventory/book{3}[1+2-position()+position()+0]/preceding::book{2}[last()]"},
        									  {"/inventory/book[1+2-position()+position()+0]/preceding::book[not(last())]", "/inventory/book{3}[1+2-position()+position()+0]/preceding::book{1}[not(last())]"},
        									  {"/inventory/book[price/@currency = \"usd\"]", "/inventory/book{1}[price{1}/@currency=\"usd\"]"},
        									  {"/inventory/book[\"usd\" = price/@currency]", "/inventory/book{1}[\"usd\"=price{1}/@currency]"},
        									  {"/inventory/book/price[text()>5]", "/inventory/book{1}/price{2}[text()>5]"},
        									  {"/inventory/book/price[\"usd\" = @currency]", "/inventory/book{1}/price{1}[\"usd\"=@currency]"},
        									  {"/inventory/book/price/@currency[.. > 5]", "/inventory/book{1}/price{2}/@currency[parent::price>5]"},
        									  {"/inventory/book/price/@currency[5 > ..]", "/inventory/book{1}/price{1}/@currency[5>parent::price]"},
        									  {"/inventory/book[(price/@currency) = (\"usd\")]", "/inventory/book{1}[(price{1}/@currency)=(\"usd\")]"},
        									  {"/inventory/book[(id(@num))/price>(5)]", "/inventory/book{1}[/id(@num{\"b1\"}))/price{1}>(5)]"},
        									  {"/inventory/book[(5) < (id(@num))/price]", "/inventory/book{1}[(5)</id(@num{\"b1\"}))/price{1}]"},
        									  {"/inventory/book[(5) < (id(@num)/price)]", "/inventory/book{1}[(5)<(id(@num{\"b1\"})/price{1})]"},
        									  {"/inventory/book[(id(@num)/price)>(5)]", "/inventory/book{1}[(id(@num{\"b1\"})/price{1})>(5)]"},
        									  {"/inventory/book[5 < self::node()/price[@currency][1]]", "/inventory/book{2}[5<self::book/price[@currency][1]]"},
        									  {"/inventory/book[5 < (id(@num)/price)/self::node()]", "/inventory/book{1}[5</id(@num{\"b1\"})/price{2}){2}/self::price]"},
        									  {"/inventory/book[(self::node()/price)[1] > 5]", "/inventory/book{2}[(self::node()/price)[1]>5]"},
        									  {"/inventory/book[5 < (self::node()/price)[1]]", "/inventory/book{2}[5<(self::node()/price)[1]]"},
        									  {"/inventory/book[self::node()/price = ./price]", "/inventory/book{1}[self::book/price{1}=self::book/price{1}]"},
        									  {"/inventory/book[self::node()/price > 4.99]", "/inventory/book{1}[self::book/price{2}>4.99]"},
        									  {"/inventory/book[self::node() =  .]", "/inventory/book{1}[self::book=self::book]"},
        									  {"/inventory/book/price[text()>3]", "/inventory/book{1}/price{1}[text()>3]"},
        									  {"/inventory/book[price[text()>3]]", "/inventory/book{1}[price{1}[text()>3]]"}
        									});
    }
 
    private String expression;
    private String correctRslt;
 
    public TestList(String expression, String correctRslt) {
 
        this.expression = expression;
        this.correctRslt = correctRslt;
    }
 
    @Test
    public void test() throws XPathExpressionException, IllegalArgumentException, NullPointerException, SAXException, IOException {
 
    	XPathProjectImplementation imp = new XPathProjectImplementation();
    	imp.loadXML("books.xml");
    	
    	String validation = ((XpathProjectNodeList) imp.evaluate(expression, XPathConstants.NODESET)).itemPath(0);
    	
        Assert.assertEquals(correctRslt, validation);
    }
}

//package XPathProj;
//import java.io.IOException;
//import java.util.Arrays;
//import java.util.Collection;
//
//import javax.xml.xpath.XPathConstants;
//import javax.xml.xpath.XPathExpressionException;
//
//import junit.framework.Assert;
//
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.junit.runners.Parameterized;
//import org.junit.runners.Parameterized.Parameters;
//import org.xml.sax.SAXException;
//
//
//
//
//@RunWith(Parameterized.class)
//public class TestList {
// 
//    @Parameters
//    public static Collection<Object[]> data() {
// 
//        return Arrays.asList(new Object[][] { { "/inventory/book[3]/preceding-sibling::book[1]", "/inventory/book{3}[3]/preceding-sibling::book{1}[1]"}, 
//        									  { "/inventory/book[chapter[section]]", "/inventory/book{1}[chapter{1}[section{1}]]"},  
//        									  { "/inventory/book[3] | /inventory/book[2]", "/inventory/book{3}[3]"},
//        									  {"/inventory/book[chapter[section[paragraph[image]]]]/chapter/section/paragraph[image]", "/inventory/book{1}[chapter{1}[section{1}[paragraph{2}[image{1}]]]]/chapter{1}/section{1}/paragraph{2}[image{1}]"},
//        									  { "/inventory/book[not((price>14 and price<2) or price=7.50)]", "/inventory/book{1}[not((price{1}>14 and price<2) or price{1}=7.50)]"},
//        									  {"/inventory/book[(price>14 and price<2) or price=7.50]" , "/inventory/book{1}[(price{2}>14 and price{3}<2) or price=7.50]"},
//        									  {"/inventory/book[not(price>10 or price<1)][chapter[title]][2]" , "/inventory/book{2}[not(price>10 or price<1)][chapter{1}[title]][2]"}, // TODO UNTIL 17.5 WAS "/inventory/book{2}[not(price>10 or price<1)][chapter{1}[title]]{2}[2]"
//        									  {"/inventory/book[price > 5]" , "/inventory/book{1}[price{2}>5]"},
//        									  {"/inventory/book[2]" , "/inventory/book{2}[2]"},
//        									  {"/inventory/book[@num]" , "/inventory/book{1}[@num]"},
//        									  {"inventory/book[not(not(chapter[section]))] | /inventory/book[last()]" , "/inventory/book{1}[not(not(chapter[section]))]"},
//        									  {"/inventory/book[chapter][not(last())][2]" , "/inventory/book{2}[chapter{1}][not(last())][2]"}, // TODO UNTIL 17.5 WAS "/inventory/book{2}[chapter{1}][not(last())]{2}[2]"
//        									  {"/inventory/book/price[.>5]" , "/inventory/book{1}/price{2}[self::price>5]"},
//        									  {"id(//@num)[..//price[. = .] > ./price]" , "/id(/descendant-or-self::node()/@num{\"b1 b2 b3\"}){1}[parent::inventory/descendant-or-self::book{3}/price{1}[self::price=self::price]>self::book/price{3}]"},
//        									  {"/inventory/book/chapter[paragraph][last()]" , "/inventory/book{1}/chapter{3}[paragraph][last()]"},
//        									  {"/inventory/book/.[price]" , "/inventory/book{1}/self::book[price{1}]"},
//        									  {"/inventory/book[5<price]" , "/inventory/book{1}[5<price{2}]"},
//        									  {"/inventory/book/price[self::node()/self::node()/text()>0]" , "/inventory/book{1}/price{1}[self::price/self::price/text()>0]"},
//        									  {"/inventory/book/price/self::node()[5<text()]" , "/inventory/book{1}/price{2}/self::price[5<text()]"},
//        									  {"//inventory/./book/price/self::node()[5<text()]" , "/descendant-or-self::#document{1}/inventory/self::inventory/book{1}/price{2}/self::price[5<text()]"},
//        									  {"/inventory/book[3]/preceding-sibling::book" , "/inventory/book{3}[3]/preceding-sibling::book{1}"},
//        									  {"(/inventory/book/chapter)[last()]" , "(/inventory/book{3}/chapter)[last()]"},
//        									  {"/inventory/book[not(not(not(priceor | chapter/sectio)))]" , "/inventory/book{1}[not(not(not(priceor | chapter/sectio)))]"}, // TODO
//        									  {"/inventory/book[orbach or (chapter/section | price[self::node()>5]) or (ofri or chapter) or (price>5)]" , "/inventory/book{1}[orbach or (chapter{1}/section{1}) or (ofri or chapter{1}) or (price{2}>5)]"},
//        									  {"/inventory/book[(price=4.99) or (price>5)]" , "/inventory/book{1}[(price=4.99) or (price{2}>5)]"},
//        									  {"/inventory/book/chapter[last()]" , "/inventory/book{1}/chapter{3}[last()]"},
//        									  {"/inventory/book[count(chapter)]" , "/inventory/book{2}[count(chapter)]"},
//        									  {"/inventory/book[position() > 1][position()=1 or count(chapter)=1]" , "/inventory/book{2}[position()>1][position()=1 or count(chapter)=1]"},
//        									  {"/inventory/book[(price>14 and price<2) or price=7.50]" , "/inventory/book{1}[(price{2}>14 and price{3}<2) or price=7.50]"},
//        									  {"/inventory/book//(chapter)[last()]" , "/inventory/book{1}/descendant-or-self::book{1}(/chapter{3})[last()]"},
//        									  {"/inventory/book[chapter/title][position() > 1]" , "/inventory/book{2}[chapter{1}/title][position()>1]"},
//        									  {"//author[last()]" , "/descendant-or-self::book{4}/author[last()]"},							  
//        									  {"/inventory/book[count(author)>=2][true()][1]" , "/inventory/book{2}[count(author)>=2][true()][1]"},
//        									  {"/inventory/family/person[@gender=\"male\"][last()]" , "/inventory/family/person{8}[@gender=\"male\"][last()]"},
//        									  {"id(\"b1 b2\")[//chapter][last()]" , "/id(\"b1 b2\"{\"b1 b2\"}){2}[descendant-or-self::book{4}/chapter{1}][last()]"},
//        									  {"/inventory[5<book/price]" , "/inventory[5<book{1}/price{2}]"},
//        									  {"(/inventory[(not((book/price) < (book/price)))])" , "(/inventory[not((book{1}/price{1})<(book{1}/price{1}))])"},
//        									  {"/inventory/book/price[0 < self::node()/self::node()/text()]" , "/inventory/book{1}/price{1}[0<self::price/self::price/text()]"},
//        									  {"/inventory/book[not(self::node()[price<0] | chapter/section)]" , "/inventory/book{3}[not(self::node()[price<0] | chapter/section)]"},
//        									  {"/inventory/book[not(1 > 1)]" , "/inventory/book{1}[not(1>1)]"},
//        									  {"/inventory/book[not(chapter/section and price<0)]" , "/inventory/book{1}[not(chapter/section or price{1}<0)]"},
//        									  {"/inventory/book[id(@num)/price>5]", "/inventory/book{1}[id(@num{\"b1\"})/price{1}>5]"},
//        									  {"/inventory/book[id(@num)/price> id(@num)/price/text()]", "/inventory/book{1}[id(@num{\"b1\"})/price{1}>id(@num{\"b1\"})/price{3}/text()]"},
//        									  {"/inventory/book[5 < id(@num)/price]", "/inventory/book{1}[5<id(@num{\"b1\"})/price{1}]"},
//        									  {"/inventory/book[chapter][not(id(@num)/price > 15)]", "/inventory/book{1}[chapter{1}][not(id(@num{\"b1\"})/price{1}>15)]"},
//        									  {"/inventory/book[chapter][not(15 < id(@num)/price)]", "/inventory/book{1}[chapter{1}][not(15<id(@num{\"b1\"})/price{1})]"},
//        									  {"/inventory/book[chapter][not(id(@num)/price < id(@num)/price)]", "/inventory/book{1}[chapter{1}][not(id(@num{\"b1\"})/price{1}<id(@num{\"b1\"})/price{1})]"},
//        									  {"/inventory/book[(chapter)]", "/inventory/book{1}[chapter{1}]"},
//        									  {"/inventory/book[not((chapt))]", "/inventory/book{1}[not((chapt))]"},
//        									  {"/inventory/book[(chapter)][not(false())]", "/inventory/book{1}[chapter{1}][not(false())]"},
//        									  {"/inventory/book[(chapter)][1][true()]", "/inventory/book{1}[chapter{1}][1][true()]"},
//        									  {"/inventory/book[(chapter)][true()][position() = 2]", "/inventory/book{2}[chapter{1}][true()][position()=2]"},
//        									  {"/inventory/(book[chapter])[2]", "/inventory(/book{2}[chapter{1}])[2]"},
//        									  {"/inventory/book[not(5 < self::node()/price)][last()]", "/inventory/book{1}[not(5<self::book/price{1})][last()]"},
//        									  {"/inventory/book[not(chapter/price)]", "/inventory/book{1}[not(chapter/price)]"},
//        									  {"/inventory/book[chapter][not(self::node()/price < id(@num)/price)]", "/inventory/book{1}[chapter{1}][not(self::book/price{1}<id(@num{\"b1\"})/price{1})]"},
//        									  {"/inventory/book[chapter][not(id(@num)/price > self::node()/price)]", "/inventory/book{1}[chapter{1}][not(id(@num{\"b1\"})/price{1}>self::book/price{1})]"},
//        									  {"/inventory/book[not(15 < self::node()/price)][(not(false()))]", "/inventory/book{1}[not(15<self::book/price{1})][not(false())]"},
//        									  {"/inventory/book[last()]", "/inventory/book{3}[last()]"},
//        									  {"/inventory/book[not(chapter/price)][not(last())]", "/inventory/book{1}[not(chapter/price)][not(last())]"},
//        									  {"/inventory/book[chapter][not(id(@num)/price > self::node()/price)][(((last())))]", "/inventory/book{3}[chapter][not(id(@num{\"b3\"})/price{1}>self::book/price{1})][last()]"},
//        									  {"//book[id(@num)]", "/descendant-or-self::inventory{2}/book{1}[id(@num{\"b1\"})]"},
//        									  {"/inventory/book[chapter and (self::node/price | chapter/section)]", "/inventory/book{1}[chapter{1} and (chapter{1}/section{1})]"},
//        									  {"/inventory/book[not(chapte)]", "/inventory/book{1}[not(chapte)]"},
//        									  {"/inventory/book[not(chapter/price > 5)]", "/inventory/book{1}[not(chapter/price > 5)]"},
//        									  {"(//chapter)[2]/title/text()", "(/descendant-or-self::book{4}/chapter{2})[2]/title/text()"},
//        									  {"/inventory/book[/inventory/book[id(@num)/price>5]/self::node()/author]", "/inventory/book{1}[inventory/book{1}[id(@num{\"b1\"})/price{1}>5]/self::book/author]"},
//        									  {"/inventory/book[not(/inventory/book[id(@num)/price>5]/self::node()/auth)]", "/inventory/book{1}[not(/inventory/book[id(@num)/price>5]/self::node()/auth)]"},
//        									  {"/inventory/book[not(not(true()))]/chapter", "/inventory/book{1}[not(not(true()))]/chapter{1}"},
//        									  {"/inventory/book[1+2-position()+position()+0]/preceding::book[last()]", "/inventory/book{3}[1+2-position()+position()+0]/preceding::book{2}[last()]"},
//        									  {"/inventory/book[1+2-position()+position()+0]/preceding::book[not(last())]", "/inventory/book{3}[1+2-position()+position()+0]/preceding::book{1}[not(last())]"}
//        									});
//    }
// 
//    private String expression;
//    private String correctRslt;
// 
//    public TestList(String expression, String correctRslt) {
// 
//        this.expression = expression;
//        this.correctRslt = correctRslt;
//    }
// 
//    @Test
//    public void test() throws XPathExpressionException, IllegalArgumentException, NullPointerException, SAXException, IOException {
// 
//    	XPathProjectImplementation imp = new XPathProjectImplementation();
//    	imp.loadXML("books.xml");
//    	
//    	String validation = ((XpathProjectNodeList) imp.evaluate(expression, XPathConstants.NODESET)).itemPath(0);
//    	
//        Assert.assertEquals(correctRslt, validation);
//    }
//}